<extend name="Base/common"/>
	    <block name="style">
		<link rel="stylesheet" type="text/css" href="/Application/Home/Common/css/head.css" />
		<link rel="stylesheet" type="text/css" href="/Application/Home/Common/css/footer.css" 

/>
		<link rel="stylesheet" type="text/css" href="/Application/Home/Common/css/iemt.css" 

/>

</block>
		<block name="script">
		<script src="/Application/Home/Common/js/jquery-1.7.2.min.js" type="text/javascript" charset="utf-8"></script>

		<script type="text/javascript">
		    $(function(){
		    	// $(".color_ul li").eq('0').addClass("on");
		    	//添加一个点击事件
		    	$(".color_ul li").click(function(){
		    		//切换颜色
		    		$(this).addClass("on").siblings().removeClass("on");
		    	});
		    	//添加商品数量
		    	$(".wrap_input .btn-add").click(function(){
		    		//获得input值
		    		var y = $("#buy_num").val();
		    		//转整
		    		x = parseInt(y)+1;
		    		$("#buy_num").val(x); 
		    		
		    	});
		    	//添加商品数量
		    	$(".wrap_input .btn-reduce").click(function(){
		    		//获得input值
		    		var y = $("#buy_num").val();
		    		//转整
		    		x = parseInt(y)-1;
		    		if(x>0){
		    		   $("#buy_num").val(x); 
		    		}
		    		
		    	});
		    });
		</script>
        <script type="text/javascript">
      $(document).ready(function(){
	// 图片上下滚动
	var count = $("#imageMenu ul li").length - 5; /* 显示 6 个 li标签内容 */
	var interval = $("#imageMenu ul li:first").width();
	var curIndex = 0;
	$("#midimg").attr("src");
	$('.scrollbutton').click(function(){
		if( $(this).hasClass('disabled') ) return false;
		
		if ($(this).hasClass('als-prev')) --curIndex;
		else ++curIndex;
		
		$('.btn').removeClass('disabled');
		if (curIndex == 0) $('.als-prev').addClass('disabled');
		if (curIndex == count-1) $('.als-next').addClass('disabled');
		
		$("#imageMenu ul ").stop(false, true).animate({"marginLeft" : -curIndex*interval + "px"}, 600);
	});
});


      // 解决 ie6 select框 问题
	$.fn.decorateIframe = function(options) {
        if ($.browser.msie && $.browser.version < 7) {
            var opts = $.extend({}, $.fn.decorateIframe.defaults, options);
            $(this).each(function() {
                var $myThis = $(this);
                //创建一个IFRAME
                var divIframe = $("<iframe />");
                divIframe.attr("id", opts.iframeId);
                divIframe.css("position", "absolute");
                divIframe.css("display", "none");
                divIframe.css("display", "block");
                divIframe.css("z-index", opts.iframeZIndex);
                divIframe.css("border");
                divIframe.css("top", "0");
                divIframe.css("left", "0");
                if (opts.width == 0) {
                    divIframe.css("width", $myThis.width() + parseInt($myThis.css("padding")) * 2 + "px");
                }
                if (opts.height == 0) {
                    divIframe.css("height", $myThis.height() + parseInt($myThis.css("padding")) * 2 + "px");
                }
                divIframe.css("filter", "mask(color=#fff)");
                $myThis.append(divIframe);
            });
        }
    }

    $.fn.decorateIframe.defaults = {
        iframeId: "decorateIframe1",
        iframeZIndex: -1,
        width: 0,
        height: 0
    }
    //放大镜视窗
    $(".zoomWindow").decorateIframe();

    //点击到中图
    var midChangeHandler = null;
    $("#imageMenu ul li img").bind("click", function(){
		if ($(this).attr("id") != "onlickImg") {
			midChange($(this).attr("src"));
			$("#imageMenu li").removeAttr("id");
			$(this).parent().attr("id", "onlickImg");
		}
	}).bind("mouseover", function(){
		if ($(this).attr("id") != "onlickImg") {
			window.clearTimeout(midChangeHandler);
			midChange($(this).attr("src"));
			$(this).css({ "border": "3px solid #959595" });
		}
	}).bind("mouseout", function(){
		if($(this).attr("id") != "onlickImg"){
			$(this).removeAttr("style");
			midChangeHandler = window.setTimeout(function(){
				midChange($("#onlickImg img").attr("src"));
			}, 1000);
		}
	});

    function midChange(src) {
        $("#midimg").attr("src", src).load(function() {
            changeViewImg();
        });
    }
    

    //大视窗看图
    function mouseover(e) {
        if ($(".zoomPup").css("display") == "none") {
            $(".zoomPup,.zoomWindow").show();
        }

        $(".zoomPup").css(fixedPosition(e));
        e.stopPropagation();
    }


    function mouseOut(e) {
        if ($(".zoomPup").css("display") != "none") {
            $(".zoomPup,.zoomWindow").hide();
        }
        e.stopPropagation();
    }
    
    
    $("#midimg").mouseover(mouseover); //中图事件
    $("#midimg,.zoomPup").mousemove(mouseover).mouseout(mouseOut); //选择器事件

    var $divWidth = $(".zoomPup").width(); //选择器宽度
    var $divHeight = $(".zoomPup").height(); //选择器高度
    var $imgWidth = $("#midimg").width(); //中图宽度
    var $imgHeight = $("#midimg").height(); //中图高度
    var $viewImgWidth = $viewImgHeight = $height = null; //IE加载后才能得到 大图宽度 大图高度 大图视窗高度

    function changeViewImg() {
        $(".zoomWindow img").attr("src", $("#midimg").attr("src"));
    }

    changeViewImg();

    $(".zoomWindow").scrollLeft(0).scrollTop(0);
    function fixedPosition(e) {
        if (e == null) {
            return;
        }
        var $imgLeft = $("#midimg").offset().left; //中图左边距
        var $imgTop = $("#midimg").offset().top; //中图上边距
        X = e.pageX - $imgLeft - $divWidth / 2; //selector顶点坐标 X
        Y = e.pageY - $imgTop - $divHeight / 2; //selector顶点坐标 Y
        X = X < 0 ? 0 : X;
        Y = Y < 0 ? 0 : Y;
        X = X + $divWidth > $imgWidth ? $imgWidth - $divWidth : X;
        Y = Y + $divHeight > $imgHeight ? $imgHeight - $divHeight : Y;

        if ($viewImgWidth == null) {
            $viewImgWidth = $(".zoomWindow img").outerWidth();
            $viewImgHeight = $(".zoomWindow img").height();
            if ($viewImgWidth < 200 || $viewImgHeight < 200) {
                $viewImgWidth = $viewImgHeight = 800;
            }
            $height = $divHeight * $viewImgHeight / $imgHeight;
            $(".zoomWindow").width($divWidth * $viewImgWidth / $imgWidth);
            $(".zoomWindow").height($height);
        }

        var scrollX = X * $viewImgWidth / $imgWidth;
        var scrollY = Y * $viewImgHeight / $imgHeight;
        $(".zoomWindow img").css({ "left": scrollX * -1, "top": scrollY * -1 });
        $(".zoomWindow").css({ "top": 0, "left": $(".divw").offset().left + $(".divw").width()-30 });

        return { left: X, top: Y };
    }

    
	</script>
		
		<script type="text/javascript">
			$(function(){
				$(".no_kc").click(function(){
					var gid ={$good.id};
					var attr = new Array();
					$(".on a").each(function(a,el){
						attr.push($(el).attr('value'));
					});

					attr.sort(function(a,b){
						return a-b;
					});
					// console.log(attr);
					$.post("{:U('Index/price')}", { attr: attr, gid: gid },
						function(data){
							if (data.status == 1) {
								$(".price_now").empty().append(data['info']['mprice']);
								$(".d_bh").empty().append("<b>库存:"+data['info']['num']+"件</b>");
								$("#attrvid").attr('value',data['info']['attrvid']);
							}
						});
				});
			});
		</script>
		<script type="text/javascript">
		$(function(){
		$('.ajax_gou').click(function(){
                var gid={$good['id']};
                var num=$('#buy_num').val();
                var attrvid=$('#attrvid').attr('value');
                var r = /^[0-9]*[1-9][0-9]*$/;
                if(!r.test(num)){
                    alert('购买数量必须为正整数');
                }    
        $.post("{:U('Car/add')}",{gid:gid,num:num,attrvid:attrvid},
           function(data){
               alert(data.info);
           });
        });
    });
</script>
		</block>
	
	
		<!--头部end-->
		<block name="main">
		<div class="w1200">
			<!--分类导航-->
			<div class="top_nv">
	    		<span><a href="{:U('Index/index')}">首页</a></span>
	    		<span>></span>
	    		<span><a href="{:U('Index/listlie',array('case'=>$res['1']['id']))}">{$res['1']['title']}</a></span>
	    		<span>></span>
	    		<span><a href="{:U('Index/listlie',array('case'=>$res['2']['id']))}">{$res['2']['title']}</a></span>
	    	</div>
			<!--分类导航-->
			<div class="con_content">
				<!--提交区域-->
				<div class="con_top">
					<div class="con_top_l">
						<div class="tab-w">
							<!--放大镜-->
							<div class="divw">
								<a href="">
									<span class="zoomPad">
	    								<img id="midimg" src=""/>
	    								<div style="top: 148px; left: 153.5px; width: 180px; height: 180px; position: absolute; border-width: 1px; display: none;" class="zoomPup" ></div>
	    								<div style="position: absolute; z-index: 500; left: 370px; top: 1px; display: none;" class="zoomWindow">
	    									<div style="width: 380px;" class="zoomWrapper"><div style="width: 100%; position: absolute; display:none;" class="zoomWrapperTitle"></div>
	    									    <div style="position: relative;width: 100%; height: 380px;overflow: hidden; z-index:999;" class="zoomWrapperImage"><img src="/Uploads/{$good.pic}" style="position: absolute; border: 0px none; display: block;  top: 0px; width: 800px; height: 800px;">
	    									    </div>
	    									</div>
	    								</div>
	    							</span>
								</a>
								
							</div>
							<!--放大镜-->
							<!--tab,ajax-->
							<div class="box-tab">
								<div class="ul-w" id="imageMenu">
									<ul class="als-wrapper">
									<if condition="is_array($good['pic']) ==true">
                         	    						  
										<volist name="good['pic']" id="v">
										<li class="als-item">

											<a href="javascipt:;"><img src="/Uploads/{$v}" /></a>
											
										</li>
										</volist>
										<else />
										<li class="als-item">

											<a href="javascipt:;"><img src="/Uploads/{$good['pic']}" /></a>
											
										</li>
										</if>
										
									</ul>
								</div>
								<div class="g_t_l_hd">
									<a href="javascript:;" class="btn l als-prev 
  disabled"></a>
									<a href="javascript:;" class="btn r als-next  "></a>
								</div>
							</div>
							<!--tab,ajax-->
						</div>
						<div class="detail_share">
							<div class="detail_sc">
								<i class="i_addsc"></i> 收藏商品
							</div>
						</div>
					</div>
					<form action="" method="post" id="iemt_form">
					<div class="con_top_r">
						<div class="detail_top">
						    
						    <input type="hidden" name="attrvid" id="attrvid" value="">
							<h1 class="detail_tit">{$good.name}</h1>
							<h2 class="detail_tit_md">{$good.des}</h2>
							<div class="price_wrap">
								<div class="detail_price">
								<b class="em_sign">￥</b>
									<span class="price_now">
	    								{$good.mprice}
	    							</span>
								</div>
								<div class="d_bh"><b>库存: 50件</b></div>
							</div>
							<div class="detail_freight">
								<span class="pop_tit ">运费：</span>
								<span id="freight" class="pop_black">包邮</span>
							</div>
							 
							<div class="detail_color">
							
							 <volist name="nicen" id="kk">
								<div class="model_wrap color_wrap">
									<span class="pop_tit" name="key" value="{$kk['id']}">{$kk['kname']}</span>
									<ul class="color_ul">
									  <volist name="kk.val" id="k">
										<li class="no_kc">
											<a href="javascript:void(0)" name="attr{$kk.id}"  value="{$k.id}">{$k.vname}</a>
											<b></b>
										</li>
										</volist>
										
									</ul>
								</div>
								</volist>

								<div class="model_wrap count_wrap">
									<span class="pop_tit">数量：</span>
									<div class="wrap_input">
										<a href="javascript://" data-param="0" class="btn-add">-</a>
										<a href="javascript://" data-param="0" class="btn-reduce">+</a>
										<input value="1" id="buy_num" class="text" onkeyup="this.value=this.value.replace(/\D/g, '');">
									</div>
								</div>
								<div class="model_wrap">
									<div class="model_submilt">
										<span class="btn_goods_remind from_gou" onclick="document.getElementById('iemt_form').submit();">立即购买</span>
										<span class="btn_goods_remind ajax_gou" >加入购物车</span>
									</div>
									<div class="detail_ewm">
										<p class="ewm_bg_img"></p>
										<p>
											<span class="fs_14">微信 支付宝</span>
											<span class="fs_14">直播商品订购减 20 元</span>
										</p>
									</div>
								</div>
							</div>
						</div>
					</div>
					</form>
				</div>
				<!--提交区域end-->
				<!--展示区域-->
				<div class="con_tab">
					<div class="con_nav">
						<div class="con_nav_c">
							<div class="w1200">
								<ul>
									<li class=""><a href="javascript:;">商品详情</a></li>
									<li><a href="javascript:;">商品参数</a></li>
									<li><a href="javascript:;">用户评价</a></li>
									<li><a href="javascript:;">为您推荐</a></li>
								</ul>
								<div class="fix_add_car">
									<div class="db_price">
										<em>¥</em>298.00
									</div>
									<a class="fixed_add_car" href="javascript:;">加入购物车</a>
								</div>
							</div>
						</div>
					</div>
				</div>
				<div class="display">
					<div class="goods_box">
						<div class="detail_lists">
							<div class="d_h2">
								<h2>商品详情</h2>
							</div>
							<div class="detail_con">
								
								<div style="margin: auto;">
									{$good.content}
								</div>
								
							</div>
						</div>
					</div>
					
	    		    		   
	    		    		</div>
	    		    	</div>
	    		    </div>
				</div> --> -->
	    		<!--展示区域end-->
	    	</div>
	    </div>
	    </block>
	    <!--底部公用-->
	  
	    <!--底部end-->
	    <!--左侧导航-->
	    
	    <!--左侧导航-->
